package models

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var DB *gorm.DB

func init() {
	var err error
	dsn := "root:root@tcp(127.0.0.1:3306)/day01"
	DB, err = gorm.Open(mysql.Open(dsn))
	if err != nil {
		panic("数据库连接失败")
	}
	DB.AutoMigrate(&House{})
}
